文章を読み込み、その単語と頻出度を返すwordNums関数を書け。 ただし、モジュールData.Listに含まれる関数を使用して良い。
import Data.List
wordNums :: String -> [(String, Int)]
wordNums str = map (\gs -> (head gs, length gs)) grouped_str
/* <system section="theme" selected="terminal"> */ | |
@import url("http://lhcpr.hatenablog.com/css/theme/terminal/terminal.css"); | |
/* </system> */ | |
#title, #blog-description { | |
padding-left: 0px; | |
} | |
/* categories */ |
(defn remove-duplicate-with-test [test coll] | |
(loop [new-coll [] src coll] | |
(if-let [first-element (first src)] | |
(recur (conj new-coll first-element) | |
(remove #(test first-element %) src)) | |
new-coll))) | |
;; (remove-duplicate-with-test = [1 2 3 4 3 2 1]) | |
;; ;=> [1 2 3 4] |
(ns check.core | |
(:require [clj-fuzzy.metrics :refer [levenshtein]])) | |
(defn pair-levenshtein-key [nk key] | |
{key (levenshtein nk (name key))}) | |
;; ex 2.42 | |
(define (enumerate-interval low high) | |
(if (> low high) | |
nil | |
(cons low (enumerate-interval (+ low 1) high)))) | |
(define (flatmap proc seq) | |
(accumulate append nil (map proc seq))) |
(defparameter *global-z* 10) | |
(let ((f (lambda (x) (+ x *global-z*)))) | |
(let ((*global-z* 3)) | |
(funcall f 3))) | |
;=> 6 |
(let ((z 5)) | |
(let ((f (lambda (x) (+ x z)))) | |
(let ((z 3)) | |
(funcall f 3)))) |
(let ((f (lambda (x) (+ x z 3)))) | |
(let ((z 3)) | |
(funcall f 3))) |
#!/bin/sh | |
#|-*- mode:lisp -*-|# | |
#| | |
exec ros -Q -- $0 "$@" | |
|# | |
(defun main (n &rest argv) | |
(declare (ignore argv)) | |
(let* ((nth (parse-integer n)) | |
(adj-mat (make-array (list nth nth)))) | |
(loop :for i :to (1- nth) :do |
#!/bin/sh | |
#|-*- mode:lisp -*-|# | |
#| | |
exec ros -Q -- $0 "$@" | |
|# | |
(unless (find-package :drakma) | |
(ql:quickload '(:drakma) :silent t)) | |
(unless (find-package :cl-json) | |
(ql:quickload '(:cl-json) :silent t)) |