Re: [Relfs-devel] Post-OCaml development. CL-FUSE
Status: Pre-Alpha
Brought to you by:
applejack
From: Michael R. <fb0...@ra...> - 2009-11-21 21:04:42
|
Vincenzo Ciancia wrote: >> Currently I write relatively ugly code, namely >> >> for n name-position 0 from "select distinct name from indexed_files" >> dir name >> for f name-position 0 from >> (fmt "select id, path from indexed_files where ~a" (clsql:sql [= (first >> n) [name]])) >> symlink name (f 1) >> >> to create a simple "name -> name bearers" index. >> >> How should it be? No need to be a Lisp expert here.. I also think about >> this now. >> > > So we are likely used to different idioms and I can't parse the above > very well. What do you mean with a "name -> name bearers" index? Is > the above a stateful language, or why are there different lines? And > what is "passed along" between these lines? It is a DSL translated to Lisp code. Most of the code is supposed to be purely functional with lexical scoping, like here. This returns the list of all registered file names, each of them names a directory containing symlinks to all the files with such name. Translation in current syntax: Run query as stated, iterate over rows of result, put the row in "n" variable and decide that there is an entry called as the first element in row. Each entry is a directory with suggested name, and its contents follows. To get contents, execute query which can be got by applying format string with "~a" to mark the place where missing condition should be substituted from parameters to string denoting SQL for comparison between first element of "n" and [name] column in default table (named in from clause). For each row the name of entry should be the first element of the row. The entry should be a symlink with suggested name and targeting the path specified in second element of the row. (both lists are closed implicitly by EOF) |